package com.yulongtian.offers.day202209.day20220906;

/**
 * @author YulongTian
 * @date 2022/9/6 - 9:31
 */
public class Test01 {
    public static void main(String[] args) {

    }

    public static int maxProfit(int[] prices) {
        int len=prices.length;
        //int[][] arr=new int[len][len];
        int max=0;
        for(int i=0;i<len-1;i++){
            for(int j=i+1;j<len;j++){
                int temp=prices[j]-prices[i];
                if(temp>max){
                    max=temp;
                }
            }
        }
        return max;

    }

}
